package com.jcnet.bizaia;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.MenuItem;

public class JCSimpleSherlockActivity extends SherlockFragmentActivity {

	protected String jcTitle;
	
	protected String jcSubtitle;
	
	
	protected void initActionBar(){
		ActionBar actionBar = getSupportActionBar();
		actionBar.setDisplayShowTitleEnabled(true);   //是都显示标题
		actionBar.setDisplayHomeAsUpEnabled(true);  //是都显示返回箭头
		getSupportActionBar().setDisplayShowHomeEnabled(false);   //   是都显示logo
		actionBar.setBackgroundDrawable(getResources().getDrawable(R.color.mainActionBg));
		actionBar.show();
		setTitle(jcTitle);
		if(jcSubtitle!=null){
		actionBar.setSubtitle(jcSubtitle);
		}
	}
	
	protected void hideAction() {
		getSupportActionBar().hide();
	}
	
	
	protected void showAction() {
		getSupportActionBar().show();
	}
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// TODO Auto-generated method stub
		switch (item.getItemId()) {
		case android.R.id.home:
			finish();
			break;

		default:
			break;
		}
		return super.onOptionsItemSelected(item);
	}
}
